"""OnlineLearn URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import TemplateView
from users.views import LoginView, RegisterView, ActiveUserView, ForgetPwdView, logoutView
from courses.views import org_listView
#静态资源url路由映射
from django.views.static import serve
from OnlineLearn.settings import MEDIA_ROOT
import xadmin

urlpatterns = [
	#后台首页
    url(r'^xadmin/', xadmin.site.urls),
    #首页
    url(r'^$|^index.html$', TemplateView.as_view(template_name='index.html'),name='index'),
    
    #登录页 #登出页
    url(r'^login/$|login.html$', LoginView.as_view(), name='login'),
    url(r'^logout/$',logoutView.as_view(), name="logout"),


    #注册页 #验证码 #激活用户
    url(r'^register/$',RegisterView.as_view(), name="register"),
    url(r'^captcha/',include('captcha.urls')),
    url(r'^active/(?P<active_code>.*)/$',ActiveUserView.as_view(), name="user_active"),
   

    #忘记密码
    url(r'^forget/$',ForgetPwdView.as_view(), name="forget_pwd"),
    #
    url(r'^org-list/$',org_listView.as_view(),name='org_list'),


    #专门处理静态资源请求映射，也就是media上传文件夹里的请求映射
    url(r'media/(?P<path>.*)$', serve, {'document_root':MEDIA_ROOT})
]
